import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/r.dart';
import 'package:flutter_app/values/MyColors.dart';
import 'package:flutter_screenutil/src/size_extension.dart';

/**
 * @Description: 自定义弹窗
 * @Author: 下雨了
 * @CreateDate: 2021-10-20 10:35
 * @UpdateUser: 更新者
 * @UpdateDate:  2021-10-20 10:35
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
///
class CustomDialog extends StatefulWidget {
  final VoidCallback onPressed;

  final String content;

  const CustomDialog({Key? key, required this.content, required this.onPressed})
      : super(key: key);

  @override
  _CustomDialogState createState() => _CustomDialogState();
}

class _CustomDialogState extends State<CustomDialog> {
  @override
  Widget build(BuildContext context) {
    return Dialog(
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(6.r),
      ),
      child: IntrinsicHeight(
        child: Container(
          width: 250.r,
          child: Column(
            children: [
              Container(
                child: Image.asset(R.assetsImgBg7, fit: BoxFit.fitWidth, ),
              ),
              Container(
                margin: EdgeInsets.only(top: 4.r),
                child: Center(
                  child: Text("报名成功", style: TextStyle(color: MyColors.FFF03F35, fontSize: 16.sp, fontWeight: FontWeight.w600),),
                ),
              ),
              Container(
                margin: EdgeInsets.only(top: 4.r),
                child: Text("效能工作因有您的参与而蒸蒸日上", style: TextStyle(color: MyColors.FF333333, fontSize: 12.sp),),
              ),
              Container(
                color: MyColors.FFF7F8F9,
                margin: EdgeInsets.only(top: 9.5.r, right: 30.r, left: 30.r),
                padding: EdgeInsets.fromLTRB(6.5.r, 7.5.r, 6.5.r, 7.5.r),
                width: MediaQuery.of(context).size.width,
                // height: 46.r,
                child: Text(
                  widget.content,
                  style: TextStyle(color: MyColors.FF666666, fontSize: 11.sp),
                  // maxLines: 2,
                  // overflow: TextOverflow.ellipsis,
                ),
              ),
              Container(
                margin: EdgeInsets.only(top: 16.r, bottom: 5.r),
                child: SizedBox(
                  width: 190.r,
                  height: 40.r,
                  child: TextButton(
                      style: ButtonStyle(
                        backgroundColor: MaterialStateProperty.all<Color>(MyColors.FFF03F35),
                        padding: MaterialStateProperty.all(EdgeInsets.all(0)),
                      ),
                      onPressed: widget.onPressed,
                      child: Text('好的', style: TextStyle(color: MyColors.FFFFFFFF, fontSize: 14.sp),
                      )),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
